﻿using BasicInformation.Domain;
using BasicInformation.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SCM.API.Read.Application.Command.Purchase;
using SCM.Domain;
using SCM.ErrorCode;
using SCM.Extensions;
using Warehouse.Domian.Model;

namespace SCM.API.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
   
    public class PurchasesController : ControllerBase
    {
        IMediator mediator;

        public PurchasesController(IMediator mediator)
        {
            this.mediator = mediator;
        }
     
        [HttpGet]
        public async Task<APIResult<PurchaseManagementModel>> ShowPurchase([FromQuery]GetPurchaseCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<SupplierModel>> GetVendor([FromQuery]GetVendorCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<ProductDTO>> LookProduct([FromQuery]LookProductCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<PurchaseManagementModel>> GetPurchaseOne([FromQuery]GetPurchaseOneCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<Stocking>> GetBatch([FromQuery]GetBatchCommand request)
        {
            return await mediator.Send(request);
        }
        [HttpGet]
        public async Task<APIResult<LocationModel>> GetLocation([FromQuery]GetLocationCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
